/* 
 * 登陆
 */
$(function () {
    /**
     * 关注
     */
    $('#attention_add').on('click', function () {
        var $btn = $(this).button('loading');
        var qid = $(this).attr('qid');
        $.ajax({
            url: '/attention/add',
            dataType: "json",
            cache: false,
            type: 'get',
            data: {qid: qid},
            success: function (data) {
                //alert(data);
            }
        });
        //$btn.button('reset');
    });
    $('#attention_cancle').on('click', function () {
        var $btn = $(this).button('loading');
        var qid = $(this).attr('qid');
        $.ajax({
            url: '/attention/cancel',
            dataType: "json",
            cache: false,
            type: 'get',
            data: {qid: qid},
            success: function (data) {
                //alert(data);
            }
        });
        //$btn.button('reset');
    });
    /**
     * 收藏
     */
    $('#collect_add').on('click', function () {
        var $btn = $(this).button('loading');
        var aid = $(this).attr('aid');
        $.ajax({
            url: '/collect/add',
            dataType: "json",
            cache: false,
            type: 'get',
            data: {aid: aid},
            success: function (data) {
                //alert(data);
            }
        });
        //$btn.button('reset');
    });
    $('#collect_cancle').on('click', function () {
        var $btn = $(this).button('loading');
        var aid = $(this).attr('aid');
        $.ajax({
            url: '/collect/cancel',
            dataType: "json",
            cache: false,
            type: 'get',
            data: {aid: aid},
            success: function (data) {
                //alert(data);
            }
        });
        //$btn.button('reset');
    });

    /**
     * 点赞
     * @returns {undefined}
     */
    $('#add_recommend').on('click', function () {
        var $btn = $(this).button('loading');
        var aid = $(this).attr('aid');
        $.ajax({
            url: '/article/add',
            dataType: "json",
            cache: false,
            type: 'get',
            data: {aid: aid},
            success: function (data) {
                //alert(data);
            }
        });
        //$btn.button('reset');
    });

    /**
     * 返回顶部
     * @returns {undefined}
     */
    $(function () {
        $.scrollUp({
            animation: 'fade',
            //activeOverlay: '#00FFFF',
            scrollImg: {
                active: true,
                type: 'background',
                src: '../plugs/scrollUp/top.png'
            }
        });
    });
    //$('#scrollUpTheme').attr('href', 'css/themes/image.css?1.1');
    //$('.image-switch').addClass('active');
});
